//
//  HWCommentsTableViewCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2020/11/13.
//  Copyright © 2020 Chendaobin. All rights reserved.
//

#import "HWCommentsTableViewCell.h"

@implementation HWCommentsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

    self.beijingyanseView.layer.cornerRadius = 10;
    self.beijingyanseView.layer.masksToBounds = YES;
    
    
    self.shangchuBut.layer.borderColor = RGB(204, 204, 204).CGColor;
    self.shangchuBut.layer.borderWidth = 1;
    self.shangchuBut.layer.cornerRadius= 8;
    self.shangchuBut.layer.masksToBounds = YES;
    

    
    self.icoiamgeView.layer.cornerRadius = 10;
    self.icoiamgeView.layer.masksToBounds= YES;
    
    self.name3Label.layer.cornerRadius = 7.5;
    self.name3Label.layer.masksToBounds = YES;
    
    self.name4label.layer.cornerRadius = 7.5;
    self.name4label.layer.masksToBounds = YES;
    

    
    
    self.name5Label.layer.cornerRadius = 7.5;
    self.name5Label.layer.masksToBounds = YES;
    
    [self.shangchuBut addTarget:self action:@selector(shanchu) forControlEvents:UIControlEventTouchUpInside];
    NSString *shanchu = [HWjianzhiduiObject keylocalization:@"删除"];
    [self.shangchuBut setTitle:shanchu forState:UIControlStateNormal];
    
    
//    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
//    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
//    maskLayer.frame = view2.bounds;
//    maskLayer.path = maskPath.CGPath;
//    view2.layer.mask = maskLayer;
//    
//    
    
    
    
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModel:(HWyouxipinglunModel *)model {
    
    _model = model;
    
  //    [NSURL URLWithString:model.icon]
    [self.icoiamgeView  sd_setImageWithURL: [NSURL URLWithString:model.icon] placeholderImage:nil];
    self.name1Label.text = [NSString stringWithFormat:@"%@",model.game];
     self.name2Label.text = [NSString stringWithFormat:@"%@",model.summary];
    
    self.name3Label.hidden = YES;
    self.name4label.hidden = YES;
    self.name5Label.hidden = YES;
    self.name4label.backgroundColor = RGB(96, 100, 241);
    self.name5Label.backgroundColor = RGB(246, 173, 1);
    
     
    for(int i = 0;i < model.biaoqian.count;i++) {
        
        
        
        if (i == 0 ) {
            
            self.name3Label.hidden = NO;
            self.name3Label.text = [NSString stringWithFormat:@"%@", model.biaoqian[i]];
            
             
        } else if (i == 1) {
            
            
              self.name4label.hidden = NO;
              self.name4label.text = [NSString stringWithFormat:@"%@", model.biaoqian[i]];
             
        } else {
            
            
             self.name5Label.hidden = NO;
             self.name5Label.text = [NSString stringWithFormat:@"%@", model.biaoqian[i]];
            
        }
        
        
        
    }
    
    self.riqiLabel.text = [NSString stringWithFormat:@"%@", model.time];
    
   //  NSString *str =@"dokcidjcjvjdfdbvhdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdokcidjcjvjdfdbvhdfbvhbvhdfdfbvhbvhdf";
    self.leirongLabel.text =  [NSString stringWithFormat:@"%@", model.content];
    
    
    
    
    if (  [model.jiajing intValue] == 1) {
        self.tubiaoiamgeView.hidden = NO;
        self.youbianshijinaLabel.constant = 4;
        
        
    }  else {
        
        
          self.tubiaoiamgeView.hidden = YES;
        self.youbianshijinaLabel.constant = -56;
        
    }
    
    
    
}



- (void)shanchu {
    
    
    
    if ([self.delegate respondsToSelector:@selector(HWCommentsTableViewCelldeleteModel:)]) {
         [self.delegate  HWCommentsTableViewCelldeleteModel:self.model];
    }

    
    
}
@end
